// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant'
import 'vant/lib/index.css'
import Clipboard from 'v-clipboard'
import VueClipboard from 'vue-clipboard2'
import store from './store'
VueClipboard.config.autoSetContainer = true // add this line
Vue.use(VueClipboard)
Vue.use(Clipboard)
Vue.use(Vant)
Vue.config.productionTip = false

/* eslint-disable no-new */
let myApp = new Vue({
  el: '#app',
  store: store,
  router,
  components: { App },
  template: '<App/>'
})

window.onresize = setHtmlFontSize
function setHtmlFontSize () {
  const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth
  const htmlDom = document.getElementsByTagName('html')[0]
  htmlDom.style.fontSize = htmlWidth / 10 + 'px'
}

setHtmlFontSize()

window.jsBrige = {
  getTokenResult: function (token) {
    myApp.$store.dispatch('setToken', token)
  }
}
